package com.stu.bean;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * @author MI
 * @ClassName DataBean.java
 * @createTime 2021年12月02日 14:34:00
 */
@Setter
@Getter
public class DataBean {
    private String name;
    private List data;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.NO_CLASS_NAME_STYLE);
    }

    public static void main(String[] args) {
        DataBean dataBean = new DataBean();
        dataBean.setData(Arrays.asList(117.27, 31.86));
        dataBean.setName("合肥");
        System.out.println(dataBean);
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("合肥", Arrays.asList(117.27, 31.86));
        hashMap.put("沈阳", new int[]{10, 20, 30, 40, 50});
        System.out.println(JSON.toJSON(hashMap));
        List list = new ArrayList();
        list.add("合肥");
        list.add(Arrays.asList(117.27, 31.86));
        System.out.println(JSON.toJSON(list));
    }
}
